package org.obm.lmtp;

import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LMTPDaemon implements IApplication {

	private static final Logger logger = LoggerFactory
			.getLogger(LMTPDaemon.class);

	private LMTPProxyServer server;

	@Override
	public Object start(IApplicationContext context) throws Exception {
		logger.info("Starting LMTP daemon...");
		server = new LMTPProxyServer();
		server.start();
		logger.info("LMTP daemon started.");
		return IApplication.EXIT_OK;
	}

	@Override
	public void stop() {
		logger.info("Stopping LMTP daemon...");
		server.stop();
		server = null;
		logger.info("LMTP daemon stopped.");
	}

}
